from flask import Flask, session
# 集成管理器脚本
from flask_script import Manager
# 集成状态保持的拓展
from flask_session import Session
# 导入redis模块
from redis import StrictRedis

app = Flask(__name__)
# 配置秘钥
app.config['SECRET_KEY'] = 'abcdefg'
# 实现状态保持,配置Session信息存储在redis数据库中
app.config['SESSION_TYPE'] = 'redis'
app.config['SESSION_REDIS'] = StrictRedis(host='127.0.0.1', port=6379)
app.config['SESSION_USE_SIGNER'] = True
# session有效期配置
app.config['PERMANENT_SESSION_LIFETIME'] = 86400
# 使用管理器对象
manage = Manager(app)
# Session实例化
Session(app)

@app.route('/')
def index():
    return 'hello world'


if __name__ == '__main__':
    # app.run()
    manage.run()